/*
 *  Copyright 2019-2020 Zheng Jie
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package me.zhengjie.modules.biz.domain;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import javax.persistence.*;
import javax.validation.constraints.*;
import javax.persistence.Entity;
import javax.persistence.Table;

import lombok.Getter;
import lombok.Setter;
import me.zhengjie.modules.system.domain.User;
import org.hibernate.annotations.*;
import java.sql.Timestamp;
import java.math.BigDecimal;
import java.io.Serializable;
import java.util.Set;

/**
 * @website https://eladmin.vip
 * @description /
 * @author Admin
 * @date 2023-03-11
 **/
@Entity
@Getter
@Setter
@Table(name="hj_hazardous_chemicals_total")
public class HazardousChemicalsTotal implements Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "`id`")
    @ApiModelProperty(value = "id")
    private Integer id;

    @Column(name = "`name`")
    @ApiModelProperty(value = "name")
    private String name;

    @Column(name = "`total_number`")
    @ApiModelProperty(value = "totalNumber")
    private float totalNumber;

    @Column(name = "`lab_id`")
    @ApiModelProperty(value = "labId")
    private Integer labId;

    @Column(name = "`cabinet_id`")
    @ApiModelProperty(value = "cabinetId")
    private Integer cabinetId;

    @Column(name = "`created_at`")
    @CreationTimestamp
    @ApiModelProperty(value = "createdAt")
    private Timestamp createdAt;

    @Column(name = "`updated_at`")
    @UpdateTimestamp
    @ApiModelProperty(value = "updatedAt")
    private Timestamp updatedAt;

    @Column(name = "`count_type`")
    @ApiModelProperty(value = "countType")
    private Integer countType;

    @Column(name = "`type`")
    @ApiModelProperty(value = "type")
    private Integer type;

    @Column(name = "`amount`")
    @ApiModelProperty(value = "amount")
    private float amount;

    @Column(name = "`danger_classes`")
    @ApiModelProperty(value = "dangerClasses")
    private Integer dangerClasses;

//    @JSONField(serialize = false)
//    @ManyToMany(mappedBy = "HazardousChemicalsTotals")
//    @ApiModelProperty(value = "耗材总表", hidden = true)
//    private Set<Project> projects;

    @Column(name = "`category`")
    @ApiModelProperty(value = "类型")
    private String category;

    @Column(name = "`unit`")
    @ApiModelProperty(value = "单位")
    private int unit;

    @Column(name = "`storage`")
    @ApiModelProperty(value = "仓库")
    private Integer storage;

    @Column(name = "`location`")
    @ApiModelProperty(value = "位置")
    private String location;

    @Column(name = "`grade`")
    @ApiModelProperty(value = "等级")
    private String grade;

    @Column(name="number")
    @ApiModelProperty(value="编号")
    private String number;

    @Column(name="batch_number")
    @ApiModelProperty(value="批次")
    private String batchNumber;

    @Column(name="ingredient_data")
    @ApiModelProperty(value="成分")
    private String ingredientData;

    @Column(name="matrix")
    @ApiModelProperty(value="基体")
    private String matrix;

    @Column(name="attenuation")
    @ApiModelProperty(value="稀释方法")
    private String attenuation;

    @Column(name="expiration_date")
    @ApiModelProperty(value="有效期")
    private Timestamp expirationDate;

    @Column(name="file_url")
    @ApiModelProperty(value="证书")
    private String fileUrl;

    @Column(name="is_audit")
    @ApiModelProperty(value="是否需要审批")
    private Integer isAudit;

    @Column(name="gross")
    @ApiModelProperty(value="累计入库总量")
    private Float gross;//累计入库总量

    @Column(name = "is_apply")
    @ApiModelProperty(value = "是否需要申领")
    private Integer isApply;

//    @Column(name = "`capacity`")
//    @ApiModelProperty(value = "容量")
//    private Float capacity;

    public void copy(HazardousChemicalsTotal source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
